package com.leyou.trade.task;

import com.leyou.trade.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class IntervalClearOrder {

    final long refreshTime = 300000;

    @Autowired
    private OrderService orderService;

    //定义订单清理周期每隔5min执行一次
    //第一次执行在启动时
    @Scheduled(fixedDelay = refreshTime)
    public void clearOrderInTime(){

        this.orderService.closeOrder();
    }
}
